package com.duke.demo.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.duke.Demo3Application;

/**
 * 
 * @author hwang
 *
 */
@Controller
public class HelloController {

	// 在Java类中创建 logger 实例
	private static final Logger logger = LoggerFactory.getLogger(Demo3Application.class);

	// 在方法中使用日志输出，如
	public void logTest() {
		logger.debug("日志输出测试 Debug");
		logger.trace("日志输出测试 Trace");
		logger.info("日志输出测试 Info");
	}

	/**
	 * 测试hello
	 * 
	 * @return
	 */
	@RequestMapping("/hello")
	public String hello(Model model) {
		model.addAttribute("name", "张三");
		this.logTest();
		return "html/hello";
	}
}
